<?php
/**
 * @link https://ym2.cleverstone.top
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

namespace builder\lists\util\lrows;

/**
 * 列表行数据类型继承类
 * @author cleverstone
 * @since ym2.0
 */
class Item
{
    /**
     * @var array 选项
     */
    protected $_options = [
        'content' => '',
        'thStyle' => '',
        'thClass' => '',
        'thAttribute' => '',
        'tdStyle' => '',
        'tdClass' => '',
        'tdAttribute' => '',
    ];

    /**
     * @param string|\Closure $content
     */
    public function __construct($content)
    {
        $this->_options['content'] = $content;
    }

    /**
     * @param array|string $style
     * @return $this
     */
    public function thStyle($style)
    {
        $this->_options['thStyle'] = $style;
        return $this;
    }

    /**
     * @param array|string $class
     * @return $this
     */
    public function thClass($class)
    {
        $this->_options['thClass'] = $class;
        return $this;
    }

    /**
     * @param array|string $attr
     * @return $this
     */
    public function thAttribute($attr)
    {
        $this->_options['thAttribute'] = $attr;
        return $this;
    }

    /**
     * @param array|string $style
     * @return $this
     */
    public function tdStyle($style)
    {
        $this->_options['tdStyle'] = $style;
        return $this;
    }

    /**
     * @param array|string $class
     * @return $this
     */
    public function tdClass($class)
    {
        $this->_options['tdClass'] = $class;
        return $this;
    }

    /**
     * @param array|string $attr
     * @return $this
     */
    public function tdAttribute($attr)
    {
        $this->_options['tdAttribute'] = $attr;
        return $this;
    }

    /**
     * @return array
     */
    public function _toArray()
    {
        return $this->_options;
    }
}